package com.tul.exercise.base.operator.egs;

import org.junit.jupiter.api.Test;

import static com.tul.exercise.base.utils.Print.print;

/**
 * @Description 《java编程思想》第3章 示例1：
 *
 *  java 的别名现象
 *
 **/
public class eg_03_Assignment {

    @Test
    public void test() {
        Tank t1 = new Tank();
        Tank t2 = new Tank();

        t1.level = 9;
        t2.level = 47;
        //String info = "t1.level:" + t1.level + ", t2.level:" + t2.level;

        print("1: " + "t1.level:" + t1.level + ", t2.level:" + t2.level);

        t1 = t2;
        print("2: " + "t1.level:" + t1.level + ", t2.level:" + t2.level);

        t1.level = 27;
        print("3: " + "t1.level:" + t1.level + ", t2.level:" + t2.level);
    }
}

class Tank{
    int level;
}
